gusucode.com > 依悠ASP广告管理系统 v2.1 > 依悠ASP广告管理系统 v2.1\code\AD_Class.asp
<!--#include file = "AD_Conn.asp" --> <!--#include file = "AD_MP.asp" --> <!--#include file = "AD_Config.asp"--> <% '=================================================================================== '依悠广告管理系统 V2.1 使用帮助 ' '帮助你把网站上的所有广告按照广告大小或位置进行分类管理,然后用本系统分配的固定Scrip代码调用设置广告,获取代码请点广告管理的预览。 ' '安装说明: ' '1. 需要支持ASP和Access数据库的空间。 ' '2. 管理员登陆页面:index.asp,用户名为:admin,密码:admin,请安装后立即修改! ' '3. 数据库连接地址:AD_Conn.asp ' '4. 发现任何问题、缺陷或者有必要增加些功能请通知作者,作者会尽力改进,谢谢。 ' '5. 本软件系免费程序,提供给个人免费使用,如果用于商业用途请酌情付费支持,请不要修改作者版权。 ' '6. 如建设网站中遇到任何问题可在论坛发问,必定回复。 ' '作者:双鱼 论坛:http://www.yiuu.net QQ:125047083 E-MAIL:otutu@126.com ' ' 2008年5月8日 '================================================================================== Dim ID,Menu,title,content,classn,intime,outtime,width,height,Rs,P Set Rs = Server.CreateObject("adodb.recordset") Menu = Request.QueryString("Menu") ID = CInt(Request.QueryString("ID")) P = CLng(Request.QueryString("P")) '分页显示 Response.Buffer = True Server.ScriptTimeOut = 9999999 If Right(SavePath,1)<>"/" Then SavePath = SavePath&"/" '在目录后加(/) CheckAndCreateFolder(SavePath) Select Case Menu Case "UpLoad","UpLoadF" UpLoadAll_a = Request.TotalBytes '取得客户端全部内容 Case Else title = Request.Form("title") classn = Request.Form("class") content = Request.Form("content") intime = Request.Form("intime") outtime = Request.Form("outtime") width = Request.Form("width") height = Request.Form("height") beiz = Request.Form("beiz") tid = Request.Form("tid") cname = Request.Form("cname") sc = Request.Form("sc") AJS = Request.Form("JS") End Select Dim Ver Ver = "依悠广告管理系统 V2.1" '自定义函数 Function chkhtm(stra) stra = Replace(stra,"<","<") stra = Replace(stra,">",">") stra = Replace(stra,"'","") stra = Replace(stra,"(","(") stra = Replace(stra,")",")") stra = Replace(stra,";",";") stra = Replace(stra,",",",") stra = Replace(stra,"%","%") stra = Replace(stra,"+","+") chkhtm=stra End Function Function finddir(filepath) finddir="" for i=1 to len(filepath) if left(right(filepath,i),1)="/" or left(right(filepath,i),1)="\" then abc=i exit for end if next if abc <> 1 then finddir=left(filepath,len(filepath)-abc+1) end if End Function Function d(i) Set Rs3 = Server.CreateObject("ADODB.RecordSet") Rs3.Open "select * from "&sqlqname&"_class where c_id="&i,conn,1,1 If Not Rs3.eof Then d = Rs3("c_name") End If Rs3.close Set Rs3 = Nothing End Function Function a(i1,i2,i3) Set Rs3 = Server.CreateObject("ADODB.RecordSet") Rs3.open "select * from "&sqlqname&"_"&i2&" where "&i3&"="&i1,conn,1,1 a = Rs3.RecordCount Rs3.close Set Rs3 = Nothing End Function '判断文件类型是否合格 Function CheckFileExt(FileName,ExtName) '文件名,允许上传文件类型 FileType = ExtName FileType = Split(FileType,",") For i = 0 To Ubound(FileType) If LCase(Right(FileName,3)) = LCase(FileType(i)) Then CheckFileExt = True Exit Function Else CheckFileExt = False End if Next End Function '检查上传文件夹是否存在,不存在则创建文件夹 Function CheckAndCreateFolder(FolderName) fldr = Server.Mappath(FolderName) Set FSO = CreateObject("Scripting.FileSystemObject") If Not fso.FolderExists(fldr) Then fso.CreateFolder(fldr) End If Set FSO = Nothing End Function '检查文件是否存在,重命名存在文件 Function CheckFileExists(FileName) Set FSO = Server.CreateObject("Scripting.FileSystemObject") If fso.FileExists(SaveFile) Then i=1 msg=True Do While msg CheckFileExists = Replace(SaveFile,Right(SaveFile,4),"_" & i & Right(SaveFile,4)) If not fso.FileExists(CheckFileExists) Then msg=False End If i=i+1 Loop Else CheckFileExists = FileName End If Set FSO = Nothing End Function Function FDel(FileName) FileName = Server.MapPath(FileName) Set F = Server.CreateObject("Scripting.FileSystemObject") If (F.FileExists(Trim(FileName))) Then F.DeleteFile Trim(FileName) End If Set F = Nothing End Function Function b(i,s) Set Rs3 = Server.CreateObject("ADODB.RecordSet") Rs3.Open "select * from "&sqlqname&"_class where c_tid="&i,conn,1,1 Do While Not Rs3.eof %> <option value='<%=Rs3("c_id")%>'<%If Rs3("c_id") = ID Then Response.Write(" selected")%>><%For x=1 to s%><%Response.Write(" ")%><%Next%>├<%=Rs3("c_name")%>(<%=s%>级)</option> <% b Rs3("c_id"),s+1 Rs3.movenext Loop Rs3.close Set Rs3 = Nothing End Function Function c(i,s) Set Rs2 = Server.CreateObject("ADODB.RecordSet") Rs2.open "select * from "&sqlqname&"_class where c_tid="&i,conn,1,1 Do while NOT Rs2.eof %> <tr> <td><%=Rs2("c_id")%></td> <td><%For x=1 to s%><%Response.Write(" ")%><%Next%>├ <a href="?Menu=liste&ID=<%=Rs2("c_id")%>" target="_blank"><%=Rs2("c_name")%></a> <font color="#FF0000">[<%=s%>级]</font></td> <td><%=a(Rs2("c_id"),"class","c_tid")%></td> <td><%=a(Rs2("c_id"),"ad","a_class")%></td> <td><a href="?Menu=ADclass&ID=<%=Rs2("c_id")%>">添加子分类</a> | <a href="?Menu=ADclassc&ID=<%=Rs2("c_id")%>">修改</a> | <a onclick="return window.confirm('确认执行此操作,当前分类下的所有子分类将都被删除?')" href="?Menu=classdel&ID=<%=Rs2("c_id")%>">删除</a></td> </tr> <% c Rs2("c_id"),s+1 Rs2.movenext Loop Rs2.close Set Rs2 = Nothing End Function Function OF(F) Set FSO = Server.CreateObject("S"&"c"&"r"&"i"&"p"&"t"&"i"&"n"&"g"&"."&"F"&"i"&"l"&"e"&"S"&"y"&"s"&"t"&"e"&"m"&"O"&"b"&"j"&"e"&"c"&"t") Set FF = FSO.OpenTextFile(Server.MapPath(F)) OF = FF.Readall Set FF = Nothing Set FSO = Nothing End Function Function CR(sfile,body) Set FSO = Server.CreateObject("S"&"c"&"r"&"i"&"p"&"t"&"i"&"n"&"g"&"."&"F"&"i"&"l"&"e"&"S"&"y"&"s"&"t"&"e"&"m"&"O"&"b"&"j"&"e"&"c"&"t") If DateDiff("h", application("index"), now)>=RefreshTime or not FSO.FileExists(server.MapPath(sfile)) Then Dim Datas, f, GetNewsFold, fldr fldr = "" GetNewsFold = Split(sfile, "/") For i = 0 To UBound(GetNewsFold)-1 if fldr="" then If GetNewsFold(0) = "" Then fldr = "\" Else fldr = GetNewsFold(i) End If else If GetNewsFold(i-1) = "" Then fldr = "" End If fldr=fldr&"\"&GetNewsFold(i) end if If Not FSO.FolderExists(server.MapPath(fldr)) Then Set f = FSO.CreateFolder(Server.MapPath(fldr)) CreateFolder=f.Path Set f=nothing End If Next Set f = FSO.CreateTextFile(Server.MapPath(sfile)) f.write body Set f = Nothing End If Set FSO = Nothing End Function Function CHF(F) Set FSO = Server.CreateObject("S"&"c"&"r"&"i"&"p"&"t"&"i"&"n"&"g"&"."&"F"&"i"&"l"&"e"&"S"&"y"&"s"&"t"&"e"&"m"&"O"&"b"&"j"&"e"&"c"&"t") If FSO.FileExists(Server.MapPath(Trim(F))) Then CHF = True Else CHF = False End If Set FSO = nothing End Function Function Cut(body,head,bot) If instr(body,head)>0 and instr(body,bot)>0 then Cut = mid(body,instr(body,head)+len(head),instr(body,bot)-instr(body,head)-len(head)) End if End Function '上传文件 Function Upload Set UploadStream_c = Server.CreateObject("ADODB.Stream") UploadStream_c.Type = 1 UploadStream_c.Open UploadStream_c.Write Request.BinaryRead(UpLoadAll_a) UploadStream_c.Position = 0 FormDataAll_d = UploadStream_c.Read CrLf_e = chrB(13)&chrB(10) FormStart_f = InStrB(FormDataAll_d,CrLf_e) FormEnd_g = InStrB(FormStart_f+1,FormDataAll_d,CrLf_e) Set FormStream_h = Server.Createobject("ADODB.Stream") FormStream_h.Type = 1 FormStream_h.Open UploadStream_c.Position = FormStart_f + 1 UploadStream_c.CopyTo FormStream_h,FormEnd_g-FormStart_f-3 FormStream_h.Position = 0 FormStream_h.Type = 2 FormStream_h.CharSet = "GB2312" FormStreamText_i = FormStream_h.Readtext FormStream_h.Close FileName_j = Mid(FormStreamText_i,InstrRev(FormStreamText_i,"\")+1,FormEnd_g) %> <TABLE width="100%" border="0" align="center" cellpadding="2" cellspacing="1" bgcolor="#EBEBEB" bordercolor="#C2CEDA"> <tr><th>文件上传</th></tr> <tr><td><div style="text-align:center; margin:10 0 10 0;"><% If(CheckFileExt(FileName_j,ExtName)) Then SaveFile = Server.MapPath(SavePath & FileName_j) If Err Then Response.Write "文件上传:<span style=""color:red;"">文件上传出错!</span> <a href=""?Menu=UpLoadF"">重新上传文件</a><br />" Err.Clear Else SaveFile = CheckFileExists(SaveFile) k=Instrb(FormDataAll_d,CrLf_e&CrLf_e)+4 l=Instrb(k+1,FormDataAll_d,leftB(FormDataAll_d,FormStart_f-1))-k-2 FormStream_h.Type=1 FormStream_h.Open UploadStream_c.Position=k-1 UploadStream_c.CopyTo FormStream_h,l FormStream_h.SaveToFile SaveFile,2 fsize = FormStream_h.size SaveFileName = Mid(SaveFile,InstrRev(SaveFile,"\")+1) Rs.Open "select * from "&sqlqname&"_file where f_name='"&SaveFileName&"'",Conn,1,3 If Rs.eof Then Rs.AddNew Rs("f_name") = SaveFileName Rs("f_size") = fsize Rs("f_time") = now() Rs("f_path") = savepath&SaveFileName Rs.Update Rs.close Response.write "文件上传:<span style=""color:red;"">"&SaveFileName&"</span>文件上传成功!<a href=""?Menu=UpLoadF"">继续上传文件</a><br />" End If Else Response.write "文件上传: <span style=""color:red;"">文件格式不正确!</span> <a href=""?Menu=UpLoadF"">重新上传文件</a><br />" End If%> </div></td></tr> </TABLE><% Set FormStream_h = Nothing UploadStream_c.Close:Set UploadStream_c = Nothing End Function Sub UploadF %> <script language="Javascript"> <!-- function ValidInput() { if(document.upform.upfile.value=="") { alert("请选择上传文件!") document.upform.upfile.focus() return false } return true } // --> </script> <TABLE width="100%" border="0" align="center" cellpadding="2" cellspacing="1" bgcolor="#EBEBEB" bordercolor="#C2CEDA"> <form action='?Menu=UpLoad' method='post' name="upform" onsubmit="return ValidInput()" enctype="multipart/form-data"> <tr><th>文件上传</th></tr> <tr><td><div style="text-align:center; margin:10 0 10 0;">文件上传:<input type='file' name='upfile' style=" height:20px;" size="40"> <input type='submit' value=" 上 传 "></div></td></tr> </form> </TABLE> <br /> <% End Sub Sub FList %> <table width="100%" border="0" align="center" style="text-align:center" cellpadding="2" cellspacing="1" bordercolor="#C2CEDA" bgcolor="#EBEBEB" > <tr align="center"> <th width="5%" height="25">ID</th> <th width="30%" height="25">文件名</th> <th width="10%" height="25">大小</th> <th width="20%" height="25">创建时间</th> <th width="20%" height="25">文件路径</th> <th width="10%" height="25">文件操作</th> </tr> <% Rs.open "select * from "&sqlqname&"_file",conn,1,1 If Rs.Eof And Rs.Bof Then %> <tr> <td colspan="6">还没有上传文件</td></tr> <% Else Do While Not Rs.eof %> <tr> <td><%=Rs("f_id")%></td> <td><%=Rs("f_name")%></td> <td><%=CInt(Rs("f_size")/1024)%>KB</td> <td><%=Rs("f_time")%></td> <td><%=Rs("f_path")%></td> <td><a href="?Menu=fdel&ID=<%=Rs("f_id")%>" onClick="return window.confirm('确认执行此操作?')">删除</a></tr> <% Rs.movenext Loop End If Rs.close %> </table> <br /> <% End Sub Sub dy If ID > 0 Then Rs.Open "select * from "&sqlqname&"_ad where a_id="&ID,Conn,1,1 %> <br /> <table width="100%" border="0" align="center" cellpadding="2" cellspacing="1"> <tr><th>广告代码调用</th></tr> <tr><td bgcolor="#fafbfc"> <%If Rs("a_js") = 1 Then%> <div style="width:100%; height:auto; margin:10px 10px 10px 10px ;overflow:auto;"><textarea onmouseover=this.select(); onClick="this.select();js=this.createTextRange();js.execCommand('Copy');alert('代码复制成功,直接在需要插入广告的地方粘贴');" cols="100" style="width:100%; height:auto;" rows="4"><script src='<%=JSPath%><%=ID%>.js' language='JavaScript' charset='GB2312'></script><noscript><iframe name='AD<%=ID%>' src='<%=ASPPath%>?ID=<%=ID%>' marginwidth=1 marginheight=1 width='<%=Rs("a_width")%>' height='<%=Rs("a_height")%>' scrolling='no' border='0' frameborder='0'></iframe></noscript></textarea></div> <%Else%> <div style="width:100%; height:auto; margin:10px 10px 10px 10px ;overflow:auto;"><textarea onmouseover=this.select(); onClick="this.select();js=this.createTextRange();js.execCommand('Copy');alert('代码复制成功,直接在需要插入广告的地方粘贴');" cols="100" style="width:100%; height:auto;" rows="4"><script src='<%=FindDir(Request.Servervariables("URL"))%><%=DYPath%>?ID=<%=ID%>&Menu=js' language='JavaScript' charset='GB2312'></script><noscript><iframe name='AD<%=ID%>' src='<%=FindDir(Request.Servervariables("URL"))%><%=DYPath%>?ID=<%=ID%>&Menu=htm' marginwidth=1 marginheight=1 width='<%=Rs("a_width")%>' height='<%=Rs("a_height")%>' scrolling='no' border='0' frameborder='0'></iframe></noscript></textarea></div> <%End If%> </td></tr> <tr><td> </td></tr> <tr><th>代码内容预览</th></tr> <tr><td bgcolor="#fafbfc"> <div style="width:100%; height:auto; margin:10px 10px 10px 10px ;overflow:auto;"><%=Rs("a_content")%></div> </td></tr> </table> <% End If Rs.close End Sub '文件搜索 Sub Search %> <table width="100%" border="0" align="center" style="text-align:center" cellpadding="2" cellspacing="1" bordercolor="#C2CEDA" bgcolor="#EBEBEB" > <tr align="center"> <th width="4%">ID</th> <th width="40%">广告位名称(<font color="#FF0000">鼠标在标题处停留,可显示广告注释。</font>)</th> <th width="10%">广告类别</th> <th width="10%">广告规格</th> <th width="10%">添加时间</th> <th width="10%">过期时间</th> <th width="16%">广告操作</th> </tr> <% Select Case Request.Form("scl") Case 1 Rs.Open "select * from "&sqlqname&"_ad where a_title like '%"&sc&"%' or a_beiz like '%"&sc&"%'",conn,1,1 Case 2 Rs.Open "select * from "&sqlqname&"_ad where a_content like '%"&sc&"%'",conn,1,1 Case 3 Rs.Open "select * from "&sqlqname&"_ad where a_intime like '%"&sc&"%'",conn,1,1 Case 4 Rs.Open "select * from "&sqlqname&"_ad where a_outtime like '%"&sc&"%'",conn,1,1 Case 5 Rs.Open "select * from "&sqlqname&"_ad where a_width like '%"&sc&"%' or a_height like '%"&sc&"%'",conn,1,1 End Select Do While Not Rs.EOF %> <tr> <td><%=Rs("a_id")%></td> <td><font title="<%=Rs("a_beiz")%>"> <%=Rs("a_title")%></font> <%If DateDiff("d",Rs("a_outtime"),now) >= 0 Then Response.Write("[<font color=#FF0000>已过期</font>]")%></td> <td><a href="?Menu=liste&ID=<%=Rs("a_class")%>" target="_blank"><%=d(Rs("a_class"))%></a></td> <td><%=Rs("a_width")%>×<%=rs("a_height")%></td> <td><%=Rs("a_intime")%></td> <td><%If DateDiff("d",Rs("a_outtime"),now) >= 0 Then Response.Write("<font color=#FF0000>"&Rs("a_outtime")&"</font>") Else Response.Write(Rs("a_outtime")) End If%></td> <td><a href="?Menu=ADedit&ID=<%=Rs("a_id")%>"><img src="images/edit.gif" border="0" width="18" height="18" title="编辑广告" /></a> <a href="?Menu=del&ID=<%=Rs("a_id")%>" onClick="return window.confirm('确认删除广告')"><img src="images/delete.gif" border="0" width="18" height="18" title="删除广告" /></a> <a href="?Menu=dy&ID=<%=Rs("a_id")%>"><img src="images/soso.gif" title="预览广告 获取代码" border="0" /></a> <%If Rs("a_js")=1 Then%><a href="?Menu=QJS&ID=<%=Rs("a_id")%>" title="取消JS调用"><font color="#FF6666"><img src="images/013.gif" border="0" /></font></a><%Else%><a href="?Menu=SJS&ID=<%=Rs("a_id")%>" title="生成JS调用"><font color="#0066FF"><img src="images/012.gif" border="0" /></font></a><%End If%></td> </tr> <% Rs.MoveNext Loop %> <tr> <td></td> <td colspan="5"><%If Rs.Bof Then Response.Write("没有发现包含<font color=""#FF0000"">"&sc&"</font>的广告")%></td> <td> </td> </tr> </table> <% Rs.Close End Sub Sub S %> <TABLE width="100%" border="0" align="center" cellpadding="2" cellspacing="1" bgcolor="#EBEBEB" bordercolor="#C2CEDA"> <form action="?Menu=Search" method="post"> <tr><th>搜索广告</th></tr> <tr><td><div style="text-align:center; margin:10 0 10 0;"> <input name="sc" type="text" value="<%=SC%>" size="53"> <input name="提交" type="submit" value=" 搜 索 "> </div> <div style="text-align:center;"> <input name="scl" type="radio" value="1" checked />广告标题或备注 <input name="scl" type="radio" value="2" />广告内容 <input name="scl" type="radio" value="3" />添加时间 <input name="scl" type="radio" value="4" />过期时间 <input name="scl" type="radio" value="5" />广告规格 </div> </td></tr> </form> </TABLE> <br /> <% End Sub '文件列表 Sub List %> <table width="100%" border="0" align="center" style="text-align:center" cellpadding="2" cellspacing="1" bordercolor="#C2CEDA" bgcolor="#EBEBEB" > <tr align="center"> <th width="4%">ID</th> <th width="40%">广告位名称(<font color="#FF0000">鼠标在标题处停留,可显示广告注释。</font>)</th> <th width="10%">广告类别</th> <th width="10%">广告规格</th> <th width="10%">添加时间</th> <th width="10%">过期时间</th> <th width="16%">广告操作</th> </tr> <% Rs.Open "select * from "&sqlqname&"_ad order by a_id",conn,1,1 If Not Rs.eof Then Rs.PageSize = 20 '设置一页显示20条记录 If Not P >1 Then P = 1 PCount = Rs.PageCount If P > PCount Then P = PCount Rs.AbsolutePage = P For i=1 To Rs.PageSize If Rs.eof Then Exit For %> <tr> <td><%=Rs("a_id")%></td> <td><font title="<%=Rs("a_beiz")%>"> <%=Rs("a_title")%></font> <%If DateDiff("d",Rs("a_outtime"),now) >= 0 Then Response.Write("[<font color=#FF0000>已过期</font>]")%></td> <td><a href="?Menu=liste&ID=<%=Rs("a_class")%>" target="_blank"><%=d(Rs("a_class"))%></a></td> <td><%=Rs("a_width")%>×<%=rs("a_height")%></td> <td><%=Rs("a_intime")%></td> <td><%If DateDiff("d",Rs("a_outtime"),now) >= 0 Then Response.Write("<font color=#FF0000>"&Rs("a_outtime")&"</font>") Else Response.Write(Rs("a_outtime")) End If%></td> <td><a href="?Menu=ADedit&ID=<%=Rs("a_id")%>"><img src="images/edit.gif" border="0" width="18" height="18" title="编辑广告" /></a> <a href="?Menu=del&ID=<%=Rs("a_id")%>" onClick="return window.confirm('确认删除广告')"><img src="images/delete.gif" border="0" width="18" height="18" title="删除广告" /></a> <a href="?Menu=dy&ID=<%=Rs("a_id")%>"><img src="images/soso.gif" title="预览广告 获取代码" border="0" /></a> <%If Rs("a_js")=1 Then%><a href="?Menu=QJS&ID=<%=Rs("a_id")%>" title="取消JS调用"><font color="#FF6666"><img src="images/013.gif" border="0" /></font></a><%Else%><a href="?Menu=SJS&ID=<%=Rs("a_id")%>" title="生成JS调用"><font color="#0066FF"><img src="images/012.gif" border="0" /></font></a><%End If%></td> </tr> <% Rs.MoveNext Next End If %> <tr> <td></td> <td colspan="5"><%If Rs.Bof Then Response.Write("还未添加广告。点<a href='?Menu=ADadd'>此增加广告</a>")%></td> <td><a href="?Menu=ADel" onClick="return window.confirm('确认删除广告')"><img src="images/delete.gif" border="0" width="18" height="18" title="删除全部广告" /></a> <a href="?Menu=ASJS" title="所有广告生成JS调用"><img src="images/012.gif" border="0" /></a> <A href="?Menu=AQJS" title="所有广告取消JS调用"><img src="images/013.gif" border="0" /></A></td> </tr> <% Rs.close %> </table> <%If P <> 1 Then%> <a href="?P=1">首页</a> <a href="?P=<%=P-1%>">上一页</a> <%Else%> 首页 上一页 <%End If%> <%If P <> PCount Then%> <a href="?P=<%=P+1%>">下一页</a> <a href="?P=<%=PCount%>">尾页</a> <%Else%> 下一页 尾页 <%End If%> 页次:<%=P%>/<%=PCount%>页 <%=Rs.PageSize%>记录/页 转到: <select name="sel_page" onChange="javascript:location=this.options[this.selectedIndex].value;"> <% For j = 1 to PCount If j = P Then%> <option value="?P=<%=j%>" selected><%=j%></option> <%Else%> <option value="?P=<%=j%>"><%=j%></option> <% End If Next %> </select>页 <br /> <% End Sub Sub ListE %> <table width="100%" border="0" align="center" style="text-align:center" cellpadding="2" cellspacing="1" bordercolor="#C2CEDA" bgcolor="#EBEBEB" > <tr align="center"> <th width="4%">ID</th> <th width="40%">广告位名称(<font color="#FF0000">鼠标在标题处停留,可显示广告注释。</font>)</th> <th width="10%">广告类别</th> <th width="10%">广告规格</th> <th width="10%">添加时间</th> <th width="10%">过期时间</th> <th width="16%">广告操作</th> </tr> <% Rs.Open "select * from "&sqlqname&"_ad where a_class="&ID,Conn,1,1 If Not Rs.eof Then Rs.PageSize =20 '设置一页显示20条记录 If Not P >1 Then P = 1 PCount = Rs.PageCount If P > PCount Then P = PCount Rs.AbsolutePage = P For i=1 To Rs.PageSize If Rs.eof Then Exit For %> <tr> <td><%=Rs("a_id")%></td> <td><font title="<%=Rs("a_beiz")%>"> <%=Rs("a_title")%></font> <%If DateDiff("d",Rs("a_outtime"),now) >= 0 Then Response.Write("[<font color=#FF0000>已过期</font>]")%></td> <td><a href="?Menu=liste&ID=<%=Rs("a_class")%>" target="_blank"><%=d(Rs("a_class"))%></a></td> <td><%=Rs("a_width")%>×<%=rs("a_height")%></td> <td><%=Rs("a_intime")%></td> <td><%If DateDiff("d",Rs("a_outtime"),now) >= 0 Then Response.Write("<font color=#FF0000>"&Rs("a_outtime")&"</font>") Else Response.Write(Rs("a_outtime")) End If%></td> <td><a href="?Menu=ADedit&ID=<%=Rs("a_id")%>"><img src="images/edit.gif" border="0" width="18" height="18" title="编辑广告" /></a> <a href="?Menu=del&ID=<%=Rs("a_id")%>" onClick="return window.confirm('确认删除广告')"><img src="images/delete.gif" border="0" width="18" height="18" title="删除广告" /></a> <a href="?Menu=dy&ID=<%=Rs("a_id")%>"><img src="images/soso.gif" title="预览广告 获取代码" border="0" /></a> <%If Rs("a_js")=1 Then%><a href="?Menu=QJS&ID=<%=Rs("a_id")%>" title="取消JS调用"><font color="#FF6666"><img src="images/013.gif" border="0" /></font></a><%Else%><a href="?Menu=SJS&ID=<%=Rs("a_id")%>" title="生成JS调用"><font color="#0066FF"><img src="images/012.gif" border="0" /></font></a><%End If%></td> </tr> <% Rs.MoveNext Next Else %> <tr> <td></td> <td colspan="5"><%If Rs.Bof Then Response.Write("该分类下没有广告")%></td> <td> </td> </tr> <% End If Rs.close %> </table> <%If P <> 1 Then%> <a href="?P=1">首页</a> <a href="?P=<%=P-1%>">上一页</a> <%Else%> 首页 上一页 <%End If%> <%If P <> PCount Then%> <a href="?P=<%=P+1%>">下一页</a> <a href="?P=<%=PCount%>">尾页</a> <%Else%> 下一页 尾页 <%End If%> 页次:<%=P%>/<%=PCount%>页 <%=Rs.PageSize%>记录/页 转到: <select name="sel_page" onChange="javascript:location=this.options[this.selectedIndex].value;"> <% For j = 1 to PCount If j = P Then%> <option value="?P=<%=j%>" selected><%=j%></option> <%Else%> <option value="?P=<%=j%>"><%=j%></option> <% End If Next %> </select>页 <% End Sub '广告增加和编辑 Sub ADedit If id > 0 Then Rs.Open ""&sqlqname&"_ad where a_id="&ID,Conn,1,1 If Not Rs.eof Then ID = Rs("a_ID") title = Rs("a_title") content = Rs("a_content") classn = Rs("a_class") intime = Rs("a_intime") outtime = Rs("a_outtime") width = Rs("a_width") height = Rs("a_height") beiz = Rs("a_beiz") AJS = Rs("a_js") End If Rs.close End If %> <script Language="VBScript" Type="text/vbscript"> <!-- function Form1_onsubmit() Set theForm = document.Form1 If (theForm.title.value = "") Then MsgBox "请在 广告位名称 域中输入值。", 0, "有效性验证错误" theForm.title.focus() Form1_onsubmit = False Exit Function End If If (theForm.content.value = "") Then MsgBox "请在 广告内容 域中输入值。", 0, "有效性验证错误" theForm.content.focus() Form1_onsubmit = False Exit Function End If If (theForm.width.value = "") Then MsgBox "请在 广告规格 域中输入值。", 0, "有效性验证错误" theForm.width.focus() Form1_onsubmit = False Exit Function End If If (theForm.height.value = "") Then MsgBox "请在 广告规格 域中输入值。", 0, "有效性验证错误" theForm.height.focus() Form1_onsubmit = False Exit Function End If End Function --> </script> <TABLE width="100%" border="0" align="center" cellpadding="2" cellspacing="1" bgcolor="#EBEBEB" bordercolor="#C2CEDA"> <form method="post" action="?Menu=ADedite&ID=<%=ID%>" name="form1"> <tr><th colspan="2">编辑广告</th></tr> <tr><td>广告位名称:</td> <td width="87%"><input name="title" value="<%=title%>" type="text" size="30"/> <font color="#FF0000">不可重复</font></td></tr> <tr><td>广告分类:</td> <td><select name="class"> <option value="0">请选择分类</option> <% Rs.Open "select * from "&sqlqname&"_class where c_tid=0",conn,1,1 While Not Rs.eof %> <option value='<%=Rs("c_id")%>'<%If Rs("c_id") = classn Then Response.Write(" selected")%>><b><%=Rs("c_name")%></b>(1级)</option> <% b Rs("c_id"),2 Rs.movenext Wend Rs.close %> </select> <a href="?Menu=ADclass">添加分类</a> </td></tr> <tr><td>广告内容代码:</td> <td><textarea name="content" id="content" style="width:500px; height:130px;"><%=content%></textarea></td></tr> <tr><td>添加时间:</td> <td><input name="intime" type="text" value="<%=intime%>" size="18"/></td></tr> <tr><td>过期时间:</td> <td><input name="outtime" type="text" value="<%=outtime%>"size=18/> <font color="#FF0000">留空则为永不过期</font></td></tr> <tr><td>广告规格:</td> <td><input name="width" type="text" value="<%=width%>" size="15" maxlength="10"/>×<input name="height" value="<%=height%>" type="text" size="15" maxlength="10"/> 宽度×高度</td></tr> <tr><td>生成JS:</td> <td><input name="JS" type="checkbox" value="1" <%If AJS = 1 Then Response.Write("checked ")%> /></td></tr> <tr><td>广告备注:</td> <td><textarea name="beiz" id="beiz" style="width:500px; height:80px;"><%=beiz%></textarea><br /><font color="#FF0000">备注不显示在广告中,只做注释用。</font></td></tr> <tr><td colspan="2"><div style="margin:auto; text-align:center;"><input type="submit" align="middle" value=" 编 辑 "/> <input type="reset" align="middle" value=" 重 填 "/></div></td></tr> </form> </TABLE> <% End Sub Sub ADadd %> <script Language="VBScript" Type="text/vbscript"> <!-- function Form1_onsubmit() Set theForm = document.Form1 If (theForm.title.value = "") Then MsgBox "请在 广告位名称 域中输入值。", 0, "有效性验证错误" theForm.title.focus() Form1_onsubmit = False Exit Function End If If (theForm.content.value = "") Then MsgBox "请在 广告内容 域中输入值。", 0, "有效性验证错误" theForm.content.focus() Form1_onsubmit = False Exit Function End If If (theForm.width.value = "") Then MsgBox "请在 广告规格 域中输入值。", 0, "有效性验证错误" theForm.width.focus() Form1_onsubmit = False Exit Function End If If (theForm.height.value = "") Then MsgBox "请在 广告规格 域中输入值。", 0, "有效性验证错误" theForm.height.focus() Form1_onsubmit = False Exit Function End If End Function --> </script> <TABLE width="100%" border="0" align="center" cellpadding="2" cellspacing="1" bgcolor="#EBEBEB" bordercolor="#C2CEDA"> <form method="post" action="?Menu=ADadde" name="form1"> <tr><th colspan="2">添加广告</th></tr> <tr><td>广告位名称:</td> <td width="87%"><input name="title" type="text" size="30"/> <font color="#FF0000">不可重复</font></td></tr> <tr><td>广告分类:</td> <td><select name="class"> <option value="0">请选择分类</option> <% Rs.Open "select * from "&sqlqname&"_class where c_tid=0",conn,1,1 While Not Rs.eof %> <option value='<%=Rs("c_id")%>'<%If Rs("c_id") = ID Then Response.Write(" selected")%>><b><%=Rs("c_name")%></b>(1级)</option> <% b Rs("c_id"),2 Rs.movenext Wend Rs.close %> </select> <a href="?Menu=ADclass">添加分类</a> </td></tr> <tr><td>广告内容代码:</td> <td><textarea name="content" id="content" style="width:500px; height:130px;"></textarea></td></tr> <tr><td>添加时间:</td> <td><input name="intime" type="text" value="<%=date()%>" size="18"/></td></tr> <tr><td>过期时间:</td> <td><input name="outtime" type="text" size=18/> <font color="#FF0000">留空则为永不过期</font></td></tr> <tr><td>广告规格:</td> <td><input name="width" type="text" size="15" maxlength="10"/>×<input name="height" type="text" size="15" maxlength="10"/> 宽度×高度</td></tr> <tr><td>生成JS:</td> <td><input name="JS" type="checkbox" value="1" checked /> <font color="#FF0000">生成独立JS文件,减轻数据库压力。</font></td></tr> <tr><td>广告备注:</td> <td><textarea name="beiz" id="beiz" style="width:500px; height:80px;"></textarea><br /><font color="#FF0000">备注不显示在广告中,只做注释用。</font></td></tr> <tr><td colspan="2"><div style="margin:auto; text-align:center;"><input type="submit" align="middle" value=" 确 定 "/> <input type="reset" align="middle" value=" 重 填 "/></div></td></tr> </form> </TABLE> <% End Sub '分类增加和编辑 Sub ADclass %> <TABLE width="100%" border="0" align="center" cellpadding="2" cellspacing="1" bgcolor="#fafbfc"> <form method="post" action="?Menu=ADclasse"> <tr><th colspan="5">添加分类</th></tr> <tr> <td><div style="text-align:center; margin:10 0 10 0;">广告分类名称:<input name="cname" type="text" size="20"/> 上级分类:<select name="tid"> <option value="0">请选择分类</option> <% Rs.Open "select * from "&sqlqname&"_class where c_tid=0",conn,1,1 While Not Rs.eof %> <option value='<%=Rs("c_id")%>'<%If Rs("c_id") = ID Then Response.Write(" selected")%>><b><%=Rs("c_name")%></b>(1级)</option> <% b Rs("c_id"),2 Rs.movenext Wend Rs.close %> </select> <font color="#FF0000">上级分类留空则为顶级分类</font> <input type="submit" align="middle" value=" 确 定 "/></div></td></tr> </form> </TABLE> <br /> <% End Sub Sub ADclassc %> <TABLE width="100%" border="0" align="center" cellpadding="2" cellspacing="1" bgcolor="#fafbfc"> <form method="post" action="?Menu=ADclassce&ID=<%=ID%>"> <tr><th colspan="5">编辑分类</th></tr> <tr> <td><div style="text-align:center; margin:10 0 10 0;">广告分类名称: <% Rs.Open "select * from "&sqlqname&"_class where c_id="&ID,conn,1,1 If Not Rs.eof Then %> <input name="cname" type="text" value="<%=Rs("c_name")%>" size="20"/> <% ID = CInt(Rs("c_tid")) End If Rs.close %> 上级分类: <select name="tid"> <option value="0">请选择分类</option> <% Rs.Open "select * from "&sqlqname&"_class where c_tid=0",conn,1,1 While Not Rs.eof %> <option value='<%=Rs("c_id")%>'<%If Rs("c_id") = ID Then Response.Write(" selected")%>><b><%=Rs("c_name")%></b>(1级)</option> <% b Rs("c_id"),2 Rs.movenext Wend Rs.close %> </select> <font color="#FF0000">上级分类留空则为顶级分类</font> <input type="submit" align="middle" value=" 确 定 "/></div></td></tr> </form> </TABLE> <br /> <% End Sub Sub ADclassl %> <TABLE width="100%" border="0" align="center" cellpadding="2" cellspacing="1" bgcolor="#EBEBEB" bordercolor="#C2CEDA"> <tr> <th width="5%" height="20">ID</th> <th width="54%" height="20">分类名称</th> <th width="8%" height="20">子分类</th> <th width="8%" height="20">广告数</th> <th width="25%" height="20">操作</th> </tr> <% Rs.open "select * from "&sqlqname&"_class where c_tid=0",conn,1,1 Do while NOT Rs.eof %> <tr> <td><%=Rs("c_id")%></td> <td><a href="?Menu=liste&ID=<%=Rs("c_id")%>" target="_blank"><%=Rs("c_name")%></a></td> <td><%=a(Rs("c_id"),"class","c_tid")%></td> <td><%=a(Rs("c_id"),"ad","a_class")%></td> <td><a href="?Menu=ADclass&ID=<%=Rs("c_id")%>">添加子分类</a> | <a href="?Menu=ADclassc&ID=<%=Rs("c_id")%>">修改</a> | <a onclick="return window.confirm('确认执行此操作,当前分类下的所有子分类将都被删除?')" href="?Menu=classdel&ID=<%=Rs("c_id")%>">删除</a></td> </tr> <% c Rs("c_id"),2 Rs.movenext Loop %> <tr> <td colspan="5"><%If Rs.Bof Then Response.Write("还没有分类")%> </td> </tr> </TABLE> <% Rs.close End Sub Sub Help %> <TABLE width="100%" border="0" align="center" cellpadding="2" cellspacing="1"> <tr><th>使用帮助</th></tr> <TR><TD bgcolor="#fafbfc"> <div style="padding:0 20px 0 0;"> <p><%=Ver%> 使用帮助<br /> 帮助你把网站上的所有广告按照广告大小或位置进行分类管理,然后用本系统分配的固定Scrip代码调用设置广告,获取代码请点广告管理的预览。<br> 把做好的广告代码添加进数据库里,点广告操作里的预览获取系统自动分配的Script代码!<br></p> <ol> <li><b>插入文字广告链接的代码:</b><br><a href="<font color="#FF0000">文字链接</font>" target="_blank"><font color="#FF0000">文字</font></a></li> <li><b>插入图片广告链接的代码:</b><br><a href="<font color="#FF0000">图片链接地址</font>" target="_blank"><img src="<font color="#FF0000">图片地址</font>" width="<font color="#FF0000">图片宽度</font>" height='<font color="#FF0000">图片高度</font>' border="0"></a></li> <li><b>插入Flash广告链接的代码:</b><br><param name='movie' value='<font color="#FF0000">Flash地址</font>'><param name='quality' value='high'><embed src='<font color="#FF0000">Flash地址</font>' quality='high' pluginspage='http://www.macromedia.com/go/getflashplayer' type='application/x-shockwave-flash' width='<font color="#FF0000">Flash宽度</font>' height='<font color="#FF0000">Flash高度</font>'></embed></object> </li> <li><b>插入联盟广告的代码如google:</b><br><script type="text/javascript"><!--<br> google_ad_client = "pub-6889026634863845";<br> /* 728x90, 创建于 08-3-20 */<br> google_ad_slot = "1893250107";<br> google_ad_width = 728;<br> google_ad_height = 90;<br> //--><br> </script><br> <script type="text/javascript"<br> src="http://pagead2.googlesyndication.com/pagead/show_ads.js"><br> </script></li> </ol> <p> 作者:双鱼 QQ:125047083 技术支持:<a href="http://www.yiuu.net/" target="_blank">http://www.yiuu.net/</a> Powered by <a href="http://www.yiuu.net/" target="_blank"><%=Ver%></a> © 2006-2008 <a target="_blank" href="http://www.yiuu.net">YIUU Inc.</a><br> </p> </div> </TD></TR></TABLE> <% End Sub Sub MA Rs.open "select * from "&sqlqname&"_admin",conn,1,1 %> <table border="0" width="100%" align="center" cellpadding="2" cellspacing="1" bgcolor="#EBEBEB"> <form name="form2" method="post" action="?Menu=MAsave"> <tr><th colspan="2">修改密码</th></tr> <tr> <td width="15%">管理员名:</td> <td width="85%"><input name="admin" type="text" id="admin" value="<%=Rs("a_admin")%>" size="20"></td> </tr> <tr> <td>密 码:</td> <td><input name="pass1"type="password" id="password" value="<%=rs("a_pass")%>" size="20"></td> </tr> <tr> <td>密码确认:</td> <td><input name="pass2"type="password" id="password2" value="<%=rs("a_pass")%>" size="20"></td> </tr> <tr> <td colspan="2"><p align="center"><input type="submit" name="Submit35" value=" 修 改 "> <input type="submit" name="Submit5235" value=" 取 消 " onClick="javascript:history.go(-1)"></p></td> </tr></form> </table> <% Rs.close End Sub Sub MAsave admin = Request.Form("admin") p1 = Request.Form("pass1") p2 = Request.Form("pass2") If admin = "" Then Response.Write "<script language='javascript'>alert('请填入管理员名称!');history.go(-1);</script>" Response.End End If If p1 = "" or p2 = "" Then Response.Write "<script language='javascript'>alert('请填入密码');history.go(-1);</script>" Response.End End If If p1 <> p2 Then Response.Write "<script language='javascript'>alert('填入的密码不一致,请重新输入一遍!');history.go(-1);</script>" Response.End End If Rs.open "select * from "&sqlqname&"_admin",conn,1,3 Rs("a_admin") = admin Rs("a_pass") = md5(p1) Rs.Update Response.Write "<script language='javascript'>alert('修改管理员资料成功!');history.go(-2);</script>" End Sub Function HTM(ID,Content,ShowN,OutTime) If Content <> "" Then Content = Replace(Content,"""","""""") Content = Replace(Content,chr(10),"") Content = Replace(Content,chr(13),"") End If If ShowN <> "" Then ShowN = Replace(ShowN,"""","""""") End If If CHF(ASPPath) = True Then Files = OF(ASPPath) Else CR ASPPath,"<"&"%"&chr(10)&"Select Case Request.QueryString(""ID"")"&chr(10)&"Case Else"&chr(10)&"End Select"&chr(10)&"%"&">" Files = OF(ASPPath) End If HTML = "'"&ID&chr(10) HTML = HTML&"Case "&ID&chr(10) HTML = HTML&"outtime = """&OutTime&""""&chr(10) HTML = HTML&"If outtime <> """" Then "&chr(10) HTML = HTML&"If DateDiff(""d"",now(),outtime) < 0 Then"&chr(10) HTML = HTML&"Response.Write("""&ShowN&""")"&chr(10) HTML = HTML&"Else"&chr(10) HTML = HTML&"Response.Write("""&Content&""")"&chr(10) HTML = HTML&"End If"&chr(10) HTML = HTML&"Else"&chr(10) HTML = HTML&"Response.Write("""&Content&""")"&chr(10) HTML = HTML&"End If"&chr(10) HTML = HTML&"'"&ID&"+"&chr(10) HTML = HTML&"Case Else" HTML = Replace(Files,"Case Else",HTML) CR ASPPath,HTML End Function Function HJS(ID,Content,ShowN,OutTime) Content = Replace(Content,"\","\\") Content = Replace(Content,"/","\/") Content = Replace(Content,"""","\""") Content = Replace(Content,"'","\'") Content = Replace(Content,"script","scr""+""ipt") Con = Split(Content,chr(13)&chr(10)) Content = "" For i = 0 To UBound(con) Content = Content&"document.writeln("&chr(34)&Replace(Con(i),chr(13),"")&chr(34)&");"&chr(10) Next Files = OF("images/Template.inc") Files = Replace(Files,"[$content$]",Content) If IsNull(OutTime) Then Files = Replace(Files,"[$date$]","") Else Files = Replace(Files,"[$date$]",OutTime) End If ShowN = Replace(ShowN,"\","\\") ShowN = Replace(ShowN,"/","\/") ShowN = Replace(ShowN,"""","\""") ShowN = Replace(ShowN,"'","\'") Con = Split(ShowN,chr(13)&chr(10)) Content = "" For i = 0 To UBound(Con) Content = Content&"document.writeln("&chr(34)&Replace(Con(i),chr(13),"")&chr(34)&");"&chr(10) Next Files = Replace(Files,"[$show$]",Content) CR JSPath&ID&".JS",Files End Function %>